#ifndef __SPRITE_H__
#define __SPRITE_H__

#include <d3d9.h>
#include <d3dx9.h>

#include "Texture.h"


class Sprite
{
private:
	LPD3DXSPRITE _SpriteHandler;
	LPWSTR fileName;

	float _TimeAni;
	float _TimeLocal;

	int _Index;
	int _TempIndex;
	int _frameBegin;
	int _frameEnd;

public:
	Texture* texture;
	Sprite(LPD3DXSPRITE SpriteHandler, Texture* Texture, float TimeAnimation, int Index);
	~Sprite();

	void Next();
	void Reset();
	void ResetLeft();
	void Update(float DelTime);
	void Render(float X, float Y, int vpX, int vpY);
	void SetFrame(int frameBegine, int frameEnd)
	{
		_frameBegin = frameBegine;
		_frameEnd = frameEnd;
	}
	void SetIndex(int index)
	{
		_Index = index;
	}
	Texture* getTexture() { return texture;}
};
#endif